import { ESGeoExtrudedPolygon } from "esobjs-xe2-plugin/dist-node/esobjs-xe2-plugin-main";
import { EnumProperty, JsonProperty } from "xbsj-xe2/dist-node/xe2-base-objects";
import { PartialWithUndefinedReactivePropsToNativeProps, ReactivePropsToNativePropsAndChanged, extendClassProps, reactJsonWithUndefined } from "xbsj-xe2/dist-node/xe2-base-utils";
import { SceneObjectKey } from "xbsj-xe2/dist-node/xe2-utils";

/**
 * 测试 ModelSer使用的挤压多边形体
 */
export class ESGeoExtrudedPolygonUFMS extends ESGeoExtrudedPolygon {
    static override readonly type = this.register('ESGeoExtrudedPolygonUFMS', this, { chsName: 'ModelSer使用的地理多边形体', tags: ['ESObjects', '_ES_Impl_Cesium', '_ES_Impl_UE'], description: "地理多边形体" });
    override get typeName() { return 'ESGeoExtrudedPolygonUFMS'; }
    override get defaultProps() { return ESGeoExtrudedPolygonUFMS.createDefaultProps(); }
    override get json() { return this._innerGetJson() as JsonType; }
    override set json(value: JsonType) { this._innerSetJson(value); }

    static override defaults = {
        ...ESGeoExtrudedPolygon.defaults,
        operation: '1' as '2' | '1',
        operations: [["2", "压平"], ["1", "裁剪"]] as [name: string, value: string][]
    }

    constructor(id?: SceneObjectKey) {
        super(id);
        this.collision = false;
    }
    override getESProperties() {
        const properties = { ...super.getESProperties() };
        return {
            ...properties,
            coordinate: [
                ...properties.coordinate,
                new EnumProperty('分析模式', '分析模式', false, false, [this, 'operation'], ESGeoExtrudedPolygonUFMS.defaults.operations, ESGeoExtrudedPolygonUFMS.defaults.operation),
                new JsonProperty("GeoJson", 'GeoJson', true, false, [this, 'srcGeom'])
            ]
        };
    };
    override getProperties(language: string) {
        return [
            ...super.getProperties(language),
            new EnumProperty('分析模式', '分析模式', false, false, [this, 'operation'], ESGeoExtrudedPolygonUFMS.defaults.operations, ESGeoExtrudedPolygonUFMS.defaults.operation),
            new JsonProperty("GeoJson", 'GeoJson', true, false, [this, 'srcGeom'])
        ];
    }
}

export namespace ESGeoExtrudedPolygonUFMS {
    export const createDefaultProps = () => ({
        ...ESGeoExtrudedPolygon.createDefaultProps(),
        operation: undefined as '2' | '1' | undefined,
        bottom: undefined as number | undefined,
        ceilling: undefined as number | undefined,
        srcGeom: reactJsonWithUndefined<{ [xx: string]: any }>(undefined),
        absoluteCeilling: undefined as boolean | undefined,
        absoluteBottom: undefined as boolean | undefined,
    });
}
extendClassProps(ESGeoExtrudedPolygonUFMS.prototype, ESGeoExtrudedPolygonUFMS.createDefaultProps);
export interface ESGeoExtrudedPolygonUFMS extends ReactivePropsToNativePropsAndChanged<ReturnType<typeof ESGeoExtrudedPolygonUFMS.createDefaultProps>> { }
type JsonType = PartialWithUndefinedReactivePropsToNativeProps<ReturnType<typeof ESGeoExtrudedPolygonUFMS.createDefaultProps> & { type: string }>;